/** 
*@Project: UIBase
*@File: ScrollViewEnhance.java
*@Author: linlin.zou
*@Date: 2014-12-3 
*@Copyright: 2014 www.boshtc.com Inc. All rights reserved.


*/
package com.alipear.uibase.view;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

public class EnhancedViewPager extends ViewPager{

    public EnhancedViewPager(Context context, AttributeSet attrs) {
        super(context, attrs);
    }
    @Override
    public boolean onTouchEvent(MotionEvent event) {
         switch (event.getAction()) {
         case MotionEvent.ACTION_MOVE: 
             getParent().requestDisallowInterceptTouchEvent(true);
             break;
         case MotionEvent.ACTION_UP:
         case MotionEvent.ACTION_CANCEL:
             getParent().requestDisallowInterceptTouchEvent(false);
             break;
        }
        return super.onTouchEvent(event);
    }
}
